/**
 * Created by yeso on 2015/9/24.
 */
angular.module('app.service.county', ['ngResource'])

    //county
    .service('CountyService', ['$resource', function ($resource) {

        //通过name,获取good
        this.getcountybyname = function (name) {
            var resource = $resource(localhost + "county/byname/:name");
            return resource.get({name: name});
        }
        this.gettownbyname = function (countyid,name) {
            var resource = $resource(localhost + "county/:countyid/byname/:name");
            return resource.get({countyid:countyid, name:name});
        }
        this.addcounty = function (county, success, error) {
            var resource = $resource(localhost + "county");
            return resource.save({}, county, success, error);
        }

    }])

    //county
    .service('CountyShopService', ['$resource', function ($resource) {
        var resource = $resource(localhost + "county/shop/:shopid");
        
        this.addcountytownshop = function (countytownshop, success, error) {
            return resource.save({}, countytownshop, success, error);
        }
        this.removecountytownshop = function (shopid) {
            return resource.remove({shopid:shopid});
        }
    }])
;